﻿<!DOCTYPE html>
<html>
<head>
<title>${@team.bangbang.common.config.Config.getProperty("spring.application.name")}</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<%
    include("/static/include/css.html"){}
    include("/static/include/js.html"){}
%>
  <link rel="stylesheet" href="../layuiadmin/style/login.css" media="all">
  <style type="text/css">
  .logo {
	position:relative;
	left:-130px;
	top:53px;
	width:72px;
	border: 0px;
  }
  </style>
</head>
<body>

  <div class="layadmin-user-login layadmin-user-display-show" id="LAY-user-login" style="display: none;">

    <div class="layadmin-user-login-main">
      <div class="layadmin-user-login-box layadmin-user-login-header">
        <img class="logo" src="../common/images/logo.png"/>
        <h2 style="padding-left:70px;">${@team.bangbang.common.config.Config.getProperty("spring.application.name")}</h2>
        <!-- p>帮助他人 成就自己</p -->
      </div>
      <form id="fLogon" onsubmit="return false" action="##" method="post">
      <div class="layadmin-user-login-box layadmin-user-login-body layui-form">
        <div class="layui-form-item">
          <label class="layadmin-user-login-icon layui-icon layui-icon-username" for="LAY-user-login-username"></label>
          <input type="email" name="user.email" id="LAY-user-login-username" lay-verify="required" placeholder="电子信箱" class="layui-input" maxlength="50">
        </div>
        <div class="layui-form-item">
          <label class="layadmin-user-login-icon layui-icon layui-icon-password" for="LAY-user-login-password"></label>
          <input type="password" name="user.password" id="LAY-user-login-password" lay-verify="required" placeholder="密码" class="layui-input" maxlength="20">
        </div>
      <%if(useValicationCode) {%>
        <div class="layui-form-item">
          <div class="layui-input-inline">
          	  <label class="layadmin-user-login-icon layui-icon layui-icon-vercode" for="LAY-user-login-vercode"></label>
	          <input type="text" name="vCode" id="LAY-user-login-vercode" lay-verify="required" placeholder="验证码" class="layui-input" maxlength="20" style="width:220px;">
          </div>
          <div class="layui-form-mid layui-word-aux" style="margin:-5px 0px 10px 30px;">
	          <div class='validImg' onclick="fGetCode()" style="cursor: pointer;"><img id="vCode" src="../common/validationCode?fontSize=20&winding=6"></div>
          </div>
        </div>
      <%}%>
        <!-- 
        <div class="layui-form-item">
          <div class="layui-row">
            <div class="layui-col-xs7">
              <label class="layadmin-user-login-icon layui-icon layui-icon-vercode" for="LAY-user-login-vercode"></label>
              <input type="text" name="vercode" id="LAY-user-login-vercode" lay-verify="required" placeholder="图形验证码" class="layui-input">
            </div>
            <div class="layui-col-xs5">
              <div style="margin-left: 10px;">
                <img src="https://www.oschina.net/action/user/captcha" class="layadmin-user-login-codeimg" id="LAY-user-get-vercode">
              </div>
            </div>
          </div>
        </div>
         -->
        <div class="layui-form-item" style="margin-bottom: 20px;">
          <input type="checkbox" name="remember" lay-skin="primary" title="记住身份" value="true">
          <i class="layui-icon layui-icon-tips" id="rememberTips" style="position:relative;font-size:16px;color:#1E9FFF;top:6px;cursor:pointer;"></i>
        </div>
        <div class="layui-form-item">
          <button class="layui-btn layui-btn-fluid" lay-submit lay-filter="LAY-user-login-submit">登 入</button>
        </div>
        <div class="layui-trans layui-form-item layadmin-user-login-other" style="text-align:center;">
          <i class="layui-icon layui-icon-release"></i>
          <label>帮助他人 成就自己</label>
        </div>
      </div>
      </form>
	  
    </div>	  
	
		<div class="layui-form-item layui-layout-admin">
			<div class="layui-input-block">
				<div class="layui-footer" style="left: 0;">
					<a href="https://beian.miit.gov.cn" target="_blank">苏ICP备2021022898号-1</a>
					<a href="http://www.bangbang.team:4999/web/#/7?page_id=1" target="_blank">Bangbang辅助类库文档</a>
				</div>
			</div>
		</div>
		
  </div>
  <script src="../layuiadmin/layui/layui.js"></script>  
  <script>
  layui.config({
    base: '../layuiadmin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'user'], function(){
    var layer = layui.layer
    ,setter = layui.setter
    ,admin = layui.admin
    ,form = layui.form
    ,router = layui.router()
    ,search = router.search;

    form.render();

    //提交
    form.on('submit(LAY-user-login-submit)', function(obj){
		var data = $("#fLogon").serializeJSON();
		
		$.ajax({
		    type: "POST",
		    dataType: "text",
		    url: "logon.do",
		    data: data,
		    success: function (result) {
		    	// 转换为json
		        result = JSON.parse(result);
		        console.log(result);
		    	if(result == null) {
		    		layer.msg("登录失败！");    	                
		            return;
		    	}
		    	
		        if (result.statusCode == 200) {
		            top.location.href = "frame.do";
		            return;
		        }
		        
		
		        layer.msg(result.message);
		    },
		    error: function () {
		    	layer.msg("网络或者服务器异常！");  
		    }
		});      
    });
  });
  <%if(useValicationCode) {%>
  function fGetCode(){
      document.getElementById("vCode").src = "../common/validationCode?fontSize=20&winding=6&t=" + (new Date()).getTime();
  }
  <%}%>
	$('#rememberTips').on("mouseover click",function(){
		layer.tips('需要浏览器允许Cookie保存', '#rememberTips', {tips:1});
	});
  </script>
</body>
</html>